import 'package:fish_redux/fish_redux.dart';

enum PracticeEditAction {
  loading,
  loaded,
  doingOcr,
  doneOcr,
  result,
  onSubmit,
  selectType,
  selectGrade,
  submit
}

class PracticeEditActionCreator {
  static Action doingOcr(int index) {
    return Action(PracticeEditAction.doingOcr, payload: index);
  }

  static Action doneOcr(Map<String, String> content) {
    return Action(PracticeEditAction.doneOcr, payload: content);
  }

  static Action loading() {
    return Action(PracticeEditAction.loading);
  }

  static Action loaded() {
    return Action(PracticeEditAction.loaded);
  }

  static Action onSubmit() {
    return const Action(PracticeEditAction.onSubmit);
  }

  static Action submit() {
    return const Action(PracticeEditAction.submit);
  }

  static Action result(Map<String, dynamic> result) {
    return Action(PracticeEditAction.result, payload: result);
  }

  static Action selectType(String item) {
    return Action(PracticeEditAction.selectType, payload: item);
  }

  static Action selectGrade(String item) {
    return Action(PracticeEditAction.selectGrade, payload: item);
  }
}
